package com.travel.recommend.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.travel.recommend.entity.InitialLikeTagEntity;
import com.travel.recommend.service.InitialLikeTagService;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.R;



/**
 * 
 *
 * @author lxw
 * @email lxw@gmail.com
 * @date 2024-01-23 15:10:56
 */
@RestController
@RequestMapping("recommend/initialliketag")
public class InitialLikeTagController {
    @Autowired
    private InitialLikeTagService initialLikeTagService;

    /**
     * 信息
     */
    @RequestMapping("/getInitialLikeTag/{userId}")
    public String getInitialLikeTag(@PathVariable("userId") Integer userId){
        return initialLikeTagService.getInitialLikeTag(userId);
    }


    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("recommend:initialliketag:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = initialLikeTagService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{initialTagId}")
    //@RequiresPermissions("recommend:initialliketag:info")
    public R info(@PathVariable("initialTagId") Integer initialTagId){
		InitialLikeTagEntity initialLikeTag = initialLikeTagService.getById(initialTagId);

        return R.ok().put("initialLikeTag", initialLikeTag);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("recommend:initialliketag:save")
    public R save(@RequestBody InitialLikeTagEntity initialLikeTag){
		initialLikeTagService.save(initialLikeTag);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("recommend:initialliketag:update")
    public R update(@RequestBody InitialLikeTagEntity initialLikeTag){
		initialLikeTagService.updateById(initialLikeTag);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("recommend:initialliketag:delete")
    public R delete(@RequestBody Integer[] initialTagIds){
		initialLikeTagService.removeByIds(Arrays.asList(initialTagIds));

        return R.ok();
    }

}
